package com.bojiu.lawsearch.lawsearch.util;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@ApiModel(value = "返回对象",description = "返回的json对象")
@Data
public class JsonResult implements Serializable {

    @ApiModelProperty(name = "code",value = "返回的code")
    private String code;

    @ApiModelProperty(name = "message",value = "返回的code的说明")
    private String message;

//    private String token;

    @ApiModelProperty(name = "data",value = "返回的具体结果")
    private Object data;

    public JsonResult(ResultCode code){
        this.code = code.getCode();
        this.message = code.getMessage();
    }

    public JsonResult(ResultCode code,Object object){
        this.code = code.getCode();
        this.message = code.getMessage();
        this.data = object;
    }

//    public JsonResult(ResultCode code,Object object){
//        this.code = code.getCode();
//        this.message = code.getMessage();
//        this.token = token;
//    }

//    JsonResult(ResultCode code,Object object,String token){
//        this.code = code.getCode();
//        this.message = code.getMessage();
//        this.data = object;
//        this.token = token;
//    }
}
